<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="author" content="zhangjiarui">
  <meta name="keywords" content="kindness>
  <meta name="description" content="this web is a place to show your kindness">
  <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet">
  <title>好人之家——张嘉睿</title>
</head>

<style >
	.header
	{
        height: 48px;
        top: 0;
        left: 0;
        right: 50;
        line-height: 50px;
		background: DarkSalmon ;
		width: 100%;
    }
	.logo
	{
        margin: 0 auto;
        float: left;
        width: 200px;
        text-align: center;
        line-height: 50px;
        font-size: 40px;
        color: Cornsilk ;
    }
    .nowuser
	{
        left: 100px;
        display: inline-block;
        padding: 0 50px;
		font-size: 30px;
		color: FireBrick ;
		font-style:italic;
    }
    .goodbye 
	{
        float: right;
        margin-right: 20px;
        display: inline-block;
        padding: 0 40px;
        color: DarkRed ;
		font-size: 20px;
    }
    .table 
	{
        margin-top: 100px;
		margin-left: 500px;
		width : 500px;
    }

</style>

<body background="background4.jpg">
	<div class = "header">
        <a class = "logo">来了您内</a>
        <a class="nowuser" id="nowuser" />
        <a class="goodbye" onclick="goodbye()">这就走了您，不吃点儿</a>    
    </div>
    <div class="table">
     <table border="100" border color="red">
        <tr>
            <td>
				<font color="black" size= "5px">用户名
			</td>
            <td>
				<font id="tableusername" color="black"size= "5px"></font>
				</td>
        </tr>
        <tr>
            <td>
				<font color="black" size= "5px">邮箱</font>
			</td>
            <td>
				<font id="tableemail" color="black"size= "5px"></font>
			</td>
        </tr>
        <tr>
            <td>
				<font color="black" size= "5px">注册时间</font>
			</td>
            <td>
				<font id="tableregister_time" color="black"size= "5px"></font>
			</td>
        </tr>
        <tr>
            <td>
				<font color="black" size= "5px">上次登录时间</font>
			</td>
            <td>
				<font id="tablelogin_time" color="black"size= "5px"></font>
			</td>
        </tr>
    </div>
    </table>
</body>

<script>

	var storage = window.localStorage;
    var password = storage["token"]; 
    
	if (password.length != 0) 
	{
        var username = storage["username"];
        var nowuser = document.getElementById('nowuser');
        nowuser.innerHTML = username;

        var usernameId = document.getElementById('tableusername');
        usernameId.innerHTML = username;

        var email = storage["email"];
        var useremail = document.getElementById('tableemail');
        useremail.innerHTML = email;

        var registerTime = storage["registerTime"]; 
        var userregisterTime = document.getElementById('tableregister_time');
        userregisterTime.innerHTML = registerTime;
    
        var loginTime = storage["loginTime"];
        var userloginTime = document.getElementById('tablelogin_time');
        userloginTime.innerHTML = loginTime;
    } 
	
	else 
	{
        self.location = 'https://zhangdahaihaha.gitee.io/denglu2';
        console.log("您没有登录就闯进来了");
    }

    function goodbye() 
	{
        var date = new Date();
        var currentTime = date.toLocaleString();
        storage["loginTime"] = currentTime;
        if (password != "") 
		{
            storage["token"] = "";
        }

        window.close();
    }

</script>
</html>  